<template>
	<view class="loading-container">
		<!-- 组织入驻 -->
		<loadingComponentsVue />
	</view>
</template>

<script>
	import loadingComponentsVue from '../../../components/loadingComponents.vue';
	import {
		removeUserTokenInfo
	} from '../../../utils/auth';
	export default {
		components: {
			loadingComponentsVue
		},
		data() {
			return {};
		},
		onShow() {
			// removeUserTokenInfo()
			this.getUserInfo()
		},
		methods: {
			async getUserInfo() {
				try {
					const {
						platform
					} = uni.getSystemInfoSync();
					const isMobile = platform === 'ios' || platform === 'android';
					// const isMobile = true
					const credentials = '(MembersCredential|WorkerMembersCredential)&PhoneNumberCredential';
					const res = await this.userTopAuth(isMobile, credentials);
					this.formDataSet(res);
				} catch (err) {
					console.error('Error fetching user info:', err);
					this.$router.back();
				}
			},
			formDataSet(row) {
				const hasPhoneNumber = row.PhoneNumberCredential;
				if (hasPhoneNumber) {
					if (row.MembersCredential || row.WorkerMembersCredential) {
						uni.redirectTo({
							url: '/pages/work/certificateoflegalpersonnel'
						});
					}
				}
			},
		}

	}
</script>

<style scoped>

</style>